<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;

use app\common\model\AdminNotify;

// 登录控制
class BatteryIndex extends Common
{
    // 显示登录页面
    public function getIndex(){

        return $this->fetch('battery_admin/admin');
    }

    public function getHeader(){
        $this->assign('name', session('name'));
        return $this->fetch('battery_admin/header');
    }
    public function getMenu()
    {
        $admin_id=session('admin_id');
        $adminModel = new \app\admin\model\AdminModel();
        $right= $adminModel->getAdminInfoById($admin_id,'admin_right');

        $rightList = \app\admin\model\RightModel::getRightName($right['admin_right']);

        $this->assign('notify_nums',AdminNotify::getAdminNotifyNum($admin_id));
        $this->assign('rightList',$rightList);
        return $this->fetch('battery_admin/menu');
    }
    public function getContent(Request $request)
    {
        $admin_name=session('name');
        $ip= $request->ip();
        $this->assign([
            'admin_name'=>$admin_name,
            'IP'=>$ip,
            'time'=>time(),
        ]);
        return $this->fetch('battery_admin/content');
    }

}